|
HSL 2.0 framework
Description of the framework
|
All methods for communication via UDP-Unicast More..
.Inherits hsl20_4_udp.hsl20_4_udp.UdpBase
Public Member Functions | |
| def | set_address (self, ip, port) |
| Sets the address where data can be received. More... | |
| def | send_to (self, data, ip, port) |
| Sends data to the specified address. More... | |
Public Member Functions inherited from hsl20_4_udp.hsl20_4_udp.UdpBase | |
| def | __init__(self, framework, context_map) |
| Constructor. More... | |
| def | set_on_data (self, callback) |
| Sets a callback for data reception. More... | |
| def | set_on_error (self, callback) |
| Sets a callback in case of an error. More... | |
| def | start_server (self) |
| Starts the UDP receive server. More... | |
All methods for communication via UDP-Unicast
Provides communication via UDP/IP in both directions.
Is derived from UdpBase.
Example 1
In example 1, a UDP server is started when a telegram arrives at input 1 (PIN_I_START). This server listens on the port which is defined by input 2 (PIN_I_PORT). All UDP telegrams arriving on this port are output on output 1 (PIN_O_RECV_DATA).
Example 2
Example 2 contains a simple UDP client. If a telegram arrives at input 1 (PIN_I_DATA), it is sent via UDP. The target computer is determined via inputs 2 (PIN_I_IP) and 3 (PIN_I_PORT).
| def hsl20_4_udp.hsl20_4_udp.Unicast.send_to | ( | self, | |
| data, | |||
| ip, | |||
| port | |||
| ) |
Sends data to the specified address
| data | string Data |
| ip | string IP address of the destination |
| port | int IP port of the destination |
| def hsl20_4_udp.hsl20_4_udp.Unicast.set_address | ( | self, | |
| ip, | |||
| port | |||
| ) |
Sets the address at which data can be received
| ip | string IP address. If an empty string is specified, the data is received at the HomeServer network address |
| port | int IP port where the data can be received and sent |
| RuntimeError | If this method is called while the server is already started, a RuntimeError exception is thrown |
1.8.13